import time

def decorator(func):
    def wrapper():
        start_time = time.time()
        f = func()
        exec_time = time.time() - start_time
        print('耗时{}秒'.format(exec_time))
        return f
    return wrapper


@decorator
def test_1():
    time.sleep(2)

test_1()
